package com.jwell.panprovider.ui.activity

import android.content.Intent
import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.View
import com.jwell.driverapp.ui.base.BaseActivity
import com.jwell.panprovider.R
import com.jwell.panprovider.ui.adapter.ViewpagerAdapter
import com.jwell.panprovider.ui.fragment.transportplane.AllProvidetFragment
import com.jwell.panprovider.ui.fragment.transportplane.ProviddingFragment
import com.jwell.panprovider.ui.fragment.transportplane.StopProvideFragment
import com.jwell.panprovider.ui.fragment.transportplane.WaitProvideFragment
import kotlinx.android.synthetic.main.activity_transport_plane.*
import kotlinx.android.synthetic.main.toolbar.*

/**
 * 运输计划
 */
class TransportPlaneActivity : BaseActivity() {
    private val tabTitles = mutableListOf("全部", "供应中", "供应结束")
    private val fragments = mutableListOf<Fragment>(
            AllProvidetFragment(),
//            WaitProvideFragment(),
            ProviddingFragment(),
            StopProvideFragment())

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_transport_plane)
        initToolBar("供料计划", true, null)

        viewPager.offscreenPageLimit = 3
        viewPager.adapter = ViewpagerAdapter(fm = supportFragmentManager, fragmentList = fragments, tabTitles = tabTitles)
        tablayout.setupWithViewPager(viewPager)
        toolbar_right_image_serarh.visibility = View.VISIBLE
        //搜索运输计划
        toolbar_right_image_serarh.setOnClickListener {
            var intent = Intent(this, TransportPlaneSearchActivity::class.java)
            startActivity(intent)
        }
    }
}
